package org.rcy.framework.thrift.metadata;

import org.apache.thrift.TEnum;
import org.apache.thrift.protocol.TType;

import java.lang.reflect.Type;

public class EnumMetaData extends FieldValueMetaData {

	private static final long serialVersionUID = 1L;

	public final Class<?> enumClass;

	/**
	 * Enum类型按照TType.I32方式保存
	 * @param javaType
	 */
	public EnumMetaData(Type javaType) {
		// 实现了TEnum接口的Enum对象按I32格式读取,默认按String读取
		super(TEnum.class.isAssignableFrom((Class<?>) javaType) ? TType.I32 : TType.STRING, javaType);
		this.enumClass = (Class<?>) javaType;
	}
}